package com.anzhen.interview;

import org.junit.Test;

/**
 * Created by zhenan on 2017/2/23.
 */
public class JVM {

    @Test
    public void testRuntime() {
        System.out.println("CPU个数:" + Runtime.getRuntime().availableProcessors());
        System.out.println("堆内存:" + Runtime.getRuntime().maxMemory() / 1024 / 1024 + "M");
        System.out.println("已用堆内存:" + Runtime.getRuntime().totalMemory() / 1024 / 1024 + "M");
        System.out.println("剩余堆内存:" + Runtime.getRuntime().freeMemory() / 1024 / 1024 + "M");
    }



}
